package com.cloudlead.plugin.security.vo;

import com.cloudlead.common.lang.annotation.HasMany;
import com.cloudlead.common.lang.annotation.Unique;
import com.cloudlead.common.lang.persistence.AbstractIdEntity;

import com.cloudlead.plugin.security.action.validator.ScResourceValidatorGroup.*;

import javax.validation.constraints.Size;

import com.cloudlead.common.lang.annotation.Domain;

import java.lang.Boolean;

import com.cloudlead.common.lang.annotation.Label;

import java.lang.String;
import javax.validation.constraints.NotNull;
import java.lang.Integer;
import java.util.ArrayList;
import java.util.List;

/**
 * ScResource is a Codegen vo type
 */
@Unique("name")
@Label("资源")
@HasMany(property = "privileges", associatedField ="scResourceId" )
@Domain(domainClassName = "com.cloudlead.plugin.security.entity.EScResource")
public class ScResource extends AbstractIdEntity<String> {

    private static final long serialVersionUID = 4438411511878L;
    @Label("是否有效")
    @NotNull(groups = {Create.class, Update.class})
    private Boolean available;

    @Label("分类，菜单或按钮等")
    @NotNull(groups = {Create.class, Update.class})
    private Integer category;

    @Label("描述")
    @Size(max = 255)
    private String description;

    @Label("图标")
    @Size(max = 255)
    private String icon;

    @Label("编号")
    @NotNull(groups = {Update.class})
    @Size(max = 24)
    private String id;

    @Label("名称")
    @NotNull(groups = {Create.class, Update.class})
    @Size(max = 255)
    private String name;

    @Label("排序")
    private Integer ordinal;

    @Label("上级编号")
    @Size(max = 24)
    private String pid;

    @Label("链接")
    @Size(max = 255)
    private String url;

    @Label("权限列表")
    private List<ScPrivilege> privileges=new ArrayList<>();

    public Boolean getAvailable() {
        return available;
    }

    public void setAvailable(Boolean available) {
        this.available = available;
    }

    public Integer getCategory() {
        return category;
    }

    public void setCategory(Integer category) {
        this.category = category;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getOrdinal() {
        return ordinal;
    }

    public void setOrdinal(Integer ordinal) {
        this.ordinal = ordinal;
    }

    public String getPid() {
        return pid;
    }

    public void setPid(String pid) {
        this.pid = pid;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public List<ScPrivilege> getPrivileges() {
        return privileges;
    }

    public void setPrivileges(List<ScPrivilege> privileges) {
        this.privileges = privileges;
    }

    public String toString() {
        return String.format("ScResource { available : %s,category : %s,description : %s,icon : %s,id : %s,name : %s,ordinal : %s,pid : %s,url : %s }", available, category, description, icon, id, name, ordinal, pid, url);
    }

}

